<template>
  <div class="default-state">
    <div class="hot-search">
      <div class="title">热门搜索</div>
      <div class="keys flex-content">
        <div
          class="key-items"
          v-for="hotkey in hotkeys"
          :key="hotkey.first"
          @click="$emit('clickKey', hotkey)"
        >
          {{ hotkey.first }}
        </div>
      </div>
    </div>

    <div class="search-history">
      <SearchItem
        l-icon="time"
        r-icon="close"
        :title="his"
        @click-close="$emit('deleteHistoryKey', i)"
        @click="$emit('search', his)"
        v-for="(his, i) in historyKey"
        :key="his"
      />
    </div>
  </div>
</template>

<script>
import { defineComponent } from "vue";

import SearchItem from "./SearchItem";

export default defineComponent({
  props: {
    hotkeys: Array,
    historyKey: Array,
  },
  components: {
    SearchItem,
  },
  // async setup() {
  //   const {
  //     hotkeys,
  //     clickKey,
  //     historyKey,
  //     deleteHistoryKey,
  //     search,
  //     currentSearchKey,
  //   } = await useHotSearchKeys();
  //   return {
  //     hotkeys,
  //     clickKey,
  //     historyKey,
  //     deleteHistoryKey,
  //     search,
  //     currentSearchKey,
  //   };
  // },
});
</script>

<style lang="scss" scoped>
.hot-search {
  padding: 0 30px;
  .title {
    font-size: 24px;
    color: #666;
    padding: 20px 0;
  }
  .key-items {
    font-size: 28px;
    color: #333;
    line-height: 64px;
    height: 64px;
    padding: 0 28px;
    border-radius: 64px;
    border: 1px solid #e0e0e0;
    margin-right: 16px;
    margin-bottom: 16px;
    box-sizing: border-box;
  }
}
</style>
